﻿
@{
    ViewBag.Title = "CancelRegister";
    Layout = "~/Views/Shared/_Index.cshtml";
}
<script>
    $(function () {
        gridList();
    });

    function gridList() {
        var $gridList = $("#gridList");
        $gridList.dataGrid({
            url: "/PatientManage/HospiterRes/GetRegisterGridJson",
            height: $(window).height() - 195,
            colModel: [
                { label: "主键", name: "patid", hidden: true, key: true },
                { label: '卡号', name: 'CardNo', width: 100, align: 'left' },
                { label: '病人性质', name: 'brxzmc', width: 100, align: 'left' },
                { label: '病历号', name: 'blh', width: 100, align: 'left' },
                { label: '姓名', name: 'xm', width: 50, align: 'left' },
                { label: '学历', name: 'xl', width: 50, align: 'left' },
                {
                    label: '性别', name: 'xb', width: 50, align: 'left',
                    formatter: function (cellvalue) {
                        return $.getGender(cellvalue);
                    }
                },
                { label: '拼音', name: 'py', width: 100, align: 'left' },
                {
                    label: '出生年月', name: 'csny', width: 80, align: 'left',
                    formatter: "date", formatoptions: { srcformat: 'Y-m-d', newformat: 'Y-m-d' }
                },
                {
                    label: '证件类型', name: 'zjlx', width: 70, align: 'left',
                    formatter: function (cellvalue) {
                        if (cellvalue) {
                            if (cellvalue.trim() === "1") {
                                // EnumZJLX
                                return "身份证";
                            } else if (cellvalue.trim() === "2") {
                                return "护照";
                            } else if (cellvalue.trim() === "3") {
                                return "军官证";
                            } else {
                                return "其他";
                            }
                        }
                        return "";
                    }
                },
                 { label: '证件号', name: 'zjh', width: 150, align: 'left' },
                 {
                     label: '年龄', name: 'nlshow', width: 50, align: 'left', formatter: function (cellvalue, a, b) {
                         return getAgeFromBirthTime({ begin: b.csny }).text;
                     }
                 },
                 { label: '电话', name: 'dh', width: 100, align: 'left' },
                 { label: '紧急联系人', name: 'jjllr', width: 100, align: 'left' },
                 { label: '联系人电话', name: 'jjlldh', width: 100, align: 'left' },
                 { label: 'CreateTime', name: 'CreateTime', hidden: true },

            ],
            pager: "#gridPager",
            sortname: 'CreateTime desc',
            rowNum: '10',
            viewrecords: true
        });
        $("#btn_search").click(function () {
            $gridList.jqGrid('setGridParam', {
                postData: { keyword: $("#xm").val(), kh: $("#searchkh").val(), blh: $("#blh").val() }
            }).trigger('reloadGrid');
        });
    }
</script>
<div class="gridPanel">
    <table id="gridList"></table>
    <div id="gridPager"></div>
</div>

